Place Declaration at the Beginning of Block (PDBB)

Description:

It is recommended to put variable declarations only at the beginning of blocks. (A block is any code surrounded by curly braces { and }.) Do not wait to declare variables until their first use. It can confuse the unwary programmer and hamper code portability within the scope.

Incorrect:

public void Put(object key, object val) {
    if (key == null) {
    	return;
    }
    Entry e = Find(key);
    ...
}

Correct:

public void Put(object key, object val) {
    Entry e;
    if (key == null) {
        return;
    }
    e = Find(key);
    ...
}